package com.example.calculator;

import cn.hutool.core.util.NumberUtil;
import org.apache.commons.lang3.math.NumberUtils;
import org.junit.Test;

/**
 * sign
 *
 * @author qingyan 2021-12-01
 */
public class SignTest {
    @Test
    public void test(){
        // 二进制
        int i = -10;
        System.out.println(i << 2);
        System.out.println(i >> 2);
        System.out.println(i >>> 2);

    }

    @Test
    public void test1() {
        int[] nums = {2,3,3,1,4,4};
        int eor = 0;
        for (int num : nums) {
            eor ^= num;
        }
        /*
           00001000

           10001000
           11110111
           11111000

           11110000

           10001111+1
           10010000
         */
        int r = eor & (~eor + 1);

        int only = 0;

        for (int cur : nums) {
            if ((cur & r) == 0) {
                only ^= cur;
            }
        }

        System.out.println(only + "  " + (only ^ eor));

    }
    @Test
    public void test4(){
        System.out.println(8^-8);
    }

}
